const key = 'SWAGGER_UI_HAND'
const baseUrLKey = 'SWAGGER_UI_HAND_BASE_URL_KEY'
const baseUrLListKey = 'SWAGGER_UI_HAND_BASE_URL_LIST_KEY'

export function saveHeaders(obj) {
  localStorage.setItem(key, JSON.stringify(obj))
}

export function saveBaseUrl(baseUrL) {
  localStorage.setItem(baseUrLKey, baseUrL)
}

export function getBaseUrl() {
  return localStorage.getItem(baseUrLKey)
}

export function saveBaseUrlList(baseUrL) {
  localStorage.setItem(baseUrLListKey, baseUrL)
}

export function getBaseUrlList() {
  const item = localStorage.getItem(baseUrLListKey)
  if (item !== null && item.length !== 0) {
    return JSON.parse(item)
  }
  return null
}

export function getHeaders() {
  const item = localStorage.getItem(key)
  if (item !== null && item.length !== 0) {
    return JSON.parse(item)
  }
  return null
}
